<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
 *
 *
 */
class Check_model extends CI_Model  {

	function get_order_data($guid){
		$query = 'select o.userName, o.email, o.phone, o.wishes, s.Name as tourDayName, o.orderDate,
    				o.startDate, o.dinner, o.child, o.priceType, o.totalPriceN, o.hotel
					from orders_tmp o, service s
					where o.guid="'.$guid.'" and o.tourDayId=s.id';
		$result = $this->db->query($query);
		if ($result->num_rows() == 1){
			return $result->result_array();
		}
		else{
			return FALSE;
		}
	}
	function get_pr_email($guid){
		$query = "select u.email from users u, orders_tmp o where o.guid='".$guid."' and o.prId=u.id";
		$result = $this->db->query($query);
		return $result->row()->email;
	}
	function get_oto_email($guid){
		$query = "select u.email from users u, orders_tmp o where o.guid='".$guid."' and o.otoId=u.id";
		$result = $this->db->query($query);
		return $result->row()->email;
	}
	function get_client_email($guid){
		$query = "select email from orders_tmp  where guid='".$guid."'";
		$result = $this->db->query($query);
		return $result->row()->email;
	}
	function update_order_data($data){
		$query = "update orders_tmp set ".$data['column']."=1 where guid='".$data['guid']."'";
		$this->db->query($query);
	}
}
?>